<%@page import="com.po.Substance"%>
<%@page import="com.dao.impl.DiscussDaoImpl"%>
<%@page import="com.dao.impl.ColumnDaoImpl"%>
<%@page import="com.po.Column"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/assets/vendor/font-awesome/css/font-awesome.min.css">
<link href="${pageContext.request.contextPath }/css/bootstrap.css"
	rel="stylesheet" type="text/css" media="all" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="${pageContext.request.contextPath }/js/jquery.min.js"></script>
<!-- Custom Theme files -->
<!--theme-style-->
<link href="${pageContext.request.contextPath }/css/style.css"
	rel="stylesheet" type="text/css" media="all" />
<!--//theme-style-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="Sport Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript">
	
	 addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } 

</script>
<!--//fonts-->
<script
		src="${pageContext.request.contextPath }/assets/vendor/jquery/jquery.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
</head>
<%
	pageContext.setAttribute("page", new ColumnDaoImpl().findAll());
	pageContext.setAttribute("pcomment", new DiscussDaoImpl()
			.findByDsid(((Substance) request.getAttribute("s"))
					.getSid()));
%>
<body>
	<!--header-->
	<div class="line"></div>
	<div class="header">
		<div class="logo">
			<a href="index.html"><img src="${pageContext.request.contextPath }/images/logo.png" alt=""></a>
		</div>
		<div class="header-top">
			<div class="header-grid">
				<ul class="header-in">
					<c:choose>
						<c:when test="${empty sessionScope.Manager }">
							<li ><a href="${pageContext.request.contextPath }/loginmanager.jsp"> 登录 </a> </li>		
							<li ><a href="${pageContext.request.contextPath }/register_ordinary.jsp"> 注册 </a> </li>
						</c:when>
						<c:when test="${!empty sessionScope.Manager }">
							<li><a>欢迎${sessionScope.Manager.uname }</a></li>
							<li ><a href="${pageContext.request.contextPath }/ordinary/ShutDownServlet.do"> 注销 </a> </li>
						</c:when>
						</c:choose>	
				</ul>
				<div class="search-box">
					<div id="sb-search" class="sb-search">
						<form>
							<input class="sb-search-input"
								placeholder="Enter your search term..." type="search"
								name="search" id="search"> <input
								class="sb-search-submit" type="submit" value=""> <span
								class="sb-icon-search"> </span>
						</form>
					</div>
				</div>
				<!-- search-scripts -->
				<script src="${pageContext.request.contextPath }/js/classie.js"></script>
				<script src="${pageContext.request.contextPath }/js/uisearch.js"></script>
				<script>
					new UISearch(document.getElementById('sb-search'));
				</script>
				<!-- //search-scripts -->
				<div class="online">
					
				</div>
				<div class="clearfix"></div>
			</div>
			<div class="header-bottom">
				<div class="h_menu4">
					<!-- start h_menu4 -->
					<a class="toggleMenu" href="#">Menu</a>
					<ul class="nav">
					<li class="active"><a href="${pageContext.request.contextPath }/ordinary/ShowIndexContextServlet.do?ptype=other&stype=hot">热点</a></li>
				<li class="active"><a href="${pageContext.request.contextPath }/ordinary/ShowIndexContextServlet.do?ptype=other&stype=recommand">推荐</a></li>
				<li class="active"><a href="${pageContext.request.contextPath }/ordinary/ShowIndexContextServlet.do?ptype=other&stype=head">头条</a></li>
						<c:forEach items="${page }" var="p">
							<li class="active"><a
								href="${pageContext.request.contextPath }/ordinary/ShowIndexContextServlet.do?ptype=lanmu&scid=${p.cid}">${p.cname }</a></li>
						</c:forEach>
						
					</ul>
					<script type="text/javascript"
						src="${pageContext.request.contextPath }/js/nav.js"></script>
				</div>
				<!-- end h_menu4 -->
				<div class="clearfix"></div>
			</div>
		</div>
		<div class="clearfix"></div>
	</div>
	<!---->
	${requestScope.s.scontent }
	<hr>
	${requestScope.s.scomment == 1 }
	<hr>
	<c:if test="${requestScope.s.scomment == 1 }">
		
		<form  
			action="${pageContext.request.contextPath }/ordinary/AddIndexDiscussServlet.do">
			
					<input type="text" class="form-control" id="firstname"
						name="discuss">
			
			<input type="hidden" name="dsid" value="${requestScope.s.sid }" />
			
					<button type="submit" class="btn btn-default">评论</button>
		
		</form>
	
	<hr>
	<c:forEach items="${pcomment }" var="p">
		<div class="panel panel-default" style="text-align: center;">
			<div class="panel-heading">
				<h3 class="panel-title">${p.duid }</h3>
			</div>
			<div class="panel-body">${p.dcontext }</div>
			<c:if test="${p.duid == Manager.uid }">
			<a href="${pageContext.request.contextPath }/ordinary/DeleteDiscuss.do?sid=${requestScope.s.sid}&did=${p.did}">删除</a>
			</c:if>
		</div>
	</c:forEach>
	</c:if>
	<hr>
</body>
</html>